//导入request.js请求工具
import request from '@/utils/request.js'

//冷库列表
export const coldStorageListService = (params) => {
    return request.get("/coldStorage/list",{params:params})
}

//冷库状态操作表
export const coldStorageStateListService = () => {
    return request.get("/coldStorage/state/list")
}
//传感器列表
export const sensorListService = (params) => {
    return request.get("/sensor/list",{params:params});
}
//传感器更新
export const sensorUpdateService = (sensor) => {
    return request.put('/sensor/update',sensor)
}
//重置
export const coldStorageRecreateService = (id) => {

    return request.get('/coldStorage/recreate',{params:{id:id}})
}
//初始化
export const coldStorageInitialService = (id,type) => {
    let params = {
        id:id,
        type:type
    }
    return request.get('/coldStorage/initial',{params:params})
}
//运行及配置
export const coldStorageRunService = (id,unitPrice,temMaximal,temMinimal,humMaximal,humMinimal) => {
    let params = {
        id:id,
        unitPrice:unitPrice,
        temMaximal:temMaximal,
        temMinimal:temMinimal,
        humMaximal:humMaximal,
        humMinimal:humMinimal
    }
    return request.get('/coldStorage/run',{params:params});
}
//终止
export const coldStorageStopService = (id) => {
    let params = {
        id:id
    }
    return request.get('/coldStorage/stop',{params:params})
}

// //消息类型集
// export const messageTypeListService = () => {
//     return request.get('/message/typeList')
// }
// //申请状态集（当消息类型为申请时需要）
// export const applicationStateListService = () => {
//     return request.get('/message/application/stateList')
// }
// //取出申请application，其中当消息类型为申请时，参数context时application的id
// export const applicationService = (content) => {
//     return request.get('/message/getApplication',{params:{content:content}})
// }
// //处理申请，即修改为rejected，passed，waiting之一
// export const applicationHandleService = (applicationId,toState) => {
//     const params = new URLSearchParams()
//     params.append("applicationId",applicationId);
//     params.append("toState",toState);
//     return request.put('/message/handleApplication',params)
// }

// //当前用户发送的申请列表
// export const applicationListService = (params) => {
//     return request.get("/message/getApplicationList",{params:params})
// }

// //发送申请
// export const applyService = (newRole) => {
//     const params = new URLSearchParams();
//     console.log(newRole);
//     params.append('newRole',newRole);
//     return request.post("/message/apply",params)
// }

// //撤回申请，并撤回申请所产生的消息
// export const withdrawApplyService = (applicationId) => {
//     return request.delete('/message/application/withdraw',{params:{applicationId}})
// }

// //消息列表
// export const messageListService = (params) => {
//     return request.get('/message/list',{params:params})
// }

// //指定id阅读消息，即标记已读
// export const messageReadSerive = (messageId) => {
//     console.log(messageId);
//     const params = new URLSearchParams()
//     params.append("messageId",messageId)
//     return request.put('/message/reading',params)
// }
// //指定id删除已读消息
// export const messageDeleteServie = (messageId) => {

//     return request.delete('/message/delete',{params:{messageId}})
// }

